package com.my.reactor.basic;

import lombok.extern.slf4j.Slf4j;
import reactor.core.publisher.Flux;
import reactor.core.scheduler.Scheduler;
import reactor.core.scheduler.Schedulers;

import java.util.concurrent.TimeUnit;

/**
 * @author: marshal
 * @date: 2023-07-24 10:09 AM
 */
@Slf4j
public class SchedulersTest {
    public static void main(String[] args) {
        test();
    }
    private static void test() {
        Scheduler single = Schedulers.single();
        log.debug("start.");
        single.schedule(() -> {
            log.debug("This is delay.");
        }, 30, TimeUnit.SECONDS);
        Flux.range(0, 10).subscribeOn(single).subscribe();
    }
}
